﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StockReport.aspx.cs" Culture="en-GB"
    Inherits="Main_Reports_Inventory_StockReport" EnableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <script src="../../../JavaScript/Commons.js" type="text/javascript"></script>
    <style type="text/css">
        #overlay
        {
            position: fixed;
            z-index: 99;
            top: 0px;
            left: 0px;
            background-color: #f8f8f8;
            width: 100%;
            height: 100%;
            filter: Alpha(Opacity=90);
            opacity: 0.9;
            -moz-opacity: 0.9;
        }
        #theprogress
        {
            background-color: #fff;
            border: 1px solid #ccc;
            padding: 10px;
            width: 300px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            filter: Alpha(Opacity=100);
            opacity: 1;
            -moz-opacity: 1;
        }
        #modalprogress
        {
            position: absolute;
            top: 40%;
            left: 50%;
            margin: -11px 0 0 -150px;
            color: #990000;
            font-weight: bold;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="4000"
            EnablePageMethods="true" EnablePartialRendering="true">
        </asp:ScriptManager>
        <acc:heading ID="pagehead" runat="server" HeadingText="Stock Report" />
        <asp:UpdateProgress ID="prgLoadingStatus" AssociatedUpdatePanelID="UPbtngetreport"
            runat="server" DynamicLayout="true">
            <ProgressTemplate>
                <div id="overlay">
                    <div id="modalprogress">
                        <div id="theprogress">
                            <asp:Image ID="imgWaitIcon" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Images/pleasewait.gif" /><br />
                            Please wait...
                        </div>
                    </div>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <div>
            <table style="background-color: #EEEEEE; height: 30px;">
                <tr>
                    <td>
                        <asp:Label ID="lblRecordNo" runat="server" Width="100px"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblperiod" runat="server" Width="200px"></asp:Label>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:Label ID="Label1" runat="server" Text="Column Name" Width="100px"></asp:Label>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:DropDownList ID="ddlColumnname" runat="server" onchange="return ToHide_Show();"
                            CssClass="dropdown">
                            <asp:ListItem Value="0"> - Select Column(s) - </asp:ListItem>
                            <asp:ListItem Value="1">Item Code</asp:ListItem>
                            <asp:ListItem Value="2">Item Name</asp:ListItem>
                            <asp:ListItem Value="3">Project</asp:ListItem>
                            <asp:ListItem Value="4">Bin No</asp:ListItem>
                            <asp:ListItem Value="5">Manufacture Part No</asp:ListItem>
                            <asp:ListItem Value="6">Item Group</asp:ListItem>
                            <asp:ListItem Value="7">Inventory Class</asp:ListItem>
                        </asp:DropDownList>
                        <script type="text/javascript">
                            function ToHide_Show() {
                                if (document.getElementById("ddlColumnname").value != "0") {
                                    //document.getElementById("txtValue").style["display"] = "block";
                                    //document.getElementById("lblvalue").style["display"] = "block";
                                    //document.getElementById("btnReport").style["display"] = "block";                                                    
                                }
                                else {
                                    //document.getElementById("txtValue").style["display"] = "none";
                                    //document.getElementById("lblvalue").style["display"] = "none";
                                    //document.getElementById("btnReport").style["display"] = "none";
                                }
                                document.getElementById("txtValue").value = '';
                            }
                        </script>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:Label ID="lblvalue" runat="server" Text="Value"></asp:Label>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:TextBox ID="txtValue" CssClass="input" runat="server"></asp:TextBox>
                    </td>
                    <%-- <td>
                        <asp:CheckBoxList ID="ChkLeasedtype" runat="server" RepeatDirection="Horizontal"
                            CssClass="input">
                            <asp:ListItem Value="1">Consigned</asp:ListItem>
                            <asp:ListItem Value="2">Owned</asp:ListItem>
                        </asp:CheckBoxList>
                        <asp:CheckBox ID="ChkConsigned" runat="server" Style="display: none;" Text="Consigned" />
                        <asp:CheckBox ID="ChkOwned" runat="server" Style="display: none;" Text="Owned" />
                    </td>--%>
                    <td style="width: 7.15%;">
                        <asp:Button ID="btnReport" runat="server" Text="Go" CssClass="button1" OnClick="btnReport_Click" />
                    </td>
                    <td style="width: 7.15%;">
                        From
                    </td>
                    <td style="width: 7.15%;">
                        <asp:TextBox ID="txtfromdate" CssClass="input" runat="server"></asp:TextBox>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="imgfromdate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <AjaxControl:CalendarExtender ID="calFrom" runat="server" PopupButtonID="imgfromdate"
                            Format="dd/MM/yyyy" TargetControlID="txtfromdate">
                        </AjaxControl:CalendarExtender>
                    </td>
                    <td style="width: 7.15%;">
                        To
                    </td>
                    <td style="width: 7.15%;">
                        <asp:TextBox ID="txttodate" CssClass="input" runat="server" onKeyPress="return isNumberKey(this.id,event);"></asp:TextBox>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="imgtoDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <AjaxControl:CalendarExtender ID="calto" runat="server" PopupButtonID="imgtoDate"
                            Format="dd/MM/yyyy" TargetControlID="txttodate">
                        </AjaxControl:CalendarExtender>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:UpdatePanel ID="UPbtngetreport" runat="server">
                            <ContentTemplate>
                                <asp:Button ID="btngetreport" runat="server" Text="Go" CssClass="button1" OnClick="btngetreport_Click"
                                    OnClientClick="return getcheck();" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <script type="text/javascript">
                            function getcheck() {
                                if (document.getElementById("txtfromdate").value == '') {
                                    alert("Please Select From Date.");
                                    document.getElementById("txtfromdate").focus();
                                    return false;
                                }
                                else if (document.getElementById("txttodate").value == '') {
                                    alert("Please Select To Date.");
                                    document.getElementById("txttodate").focus();
                                    return false;
                                }
                            }
                        </script>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="imgbtnPrint" runat="server" OnClientClick="printpanel();" ImageUrl="../../../Images/print.png" />&nbsp;
                        <script type="text/javascript">
                            function printpanel() {
                                var printcontent = document.getElementById('grdStockReport');
                                window.print(printcontent.innerHTML);
                            }
                        </script>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="ImgBtnExcel" ToolTip="Export to Excel" runat="server" Height="15px"
                            ImageUrl="~/Images/Excel.png" OnClick="ImgBtnExcel_Click" />
                    </td>
                </tr>
            </table>
            <asp:UpdatePanel ID="UpdateStockreport" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="grdStockReport" runat="server" AutoGenerateColumns="False" CssClass="gridview"
                        EmptyDataText="No Record Found !!" OnPageIndexChanging="grdStockReport_PageIndexChanging"
                        Width="100%" OnRowDataBound="grdStockReport_RowDataBound" ShowFooter="true" FooterStyle-BackColor="#88BD6E">
                        <Columns>
                            <asp:TemplateField HeaderText="S.No.">
                                <ItemTemplate>
                                    <%# Container.DataItemIndex + 1 %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Item Code" DataField="ITMCODE" />
                            <asp:BoundField HeaderText="Item Name" DataField="ITMDESC" />
                            <asp:BoundField HeaderText="Bin Ref" DataField="BINREF" />
                            <asp:BoundField HeaderText="Alt Item Code" DataField="ALTITEMCODE" />
                            <asp:BoundField HeaderText="Alt Item Desc" DataField="ITEMADDLNAME" />
                            <asp:BoundField HeaderText="MPN" DataField="MPNNO" />
                            <asp:BoundField HeaderText="Location ID" DataField="LOCATIONID" />
                            <asp:BoundField HeaderText="Item Group" DataField="ITEMGROUP" />
                            <asp:BoundField HeaderText="Project Name" DataField="PROJECTNAME" />
                            <asp:BoundField HeaderText="Leased Type" DataField="LEASEDTYPE" FooterText="Total" />
                            <asp:BoundField HeaderText="Opening Qty" DataField="OpeningQty" ItemStyle-BackColor="#B3D6A2" DataFormatString="{0:0}" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Opening Value" DataField="OpeningValue" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Purchase Qty" DataField="PurchaseQty" ItemStyle-BackColor="#B3D6A2" DataFormatString="{0:0}" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Purchase Value" DataField="PurchaseValue" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Issue Qty" DataField="IssueQTY" ItemStyle-BackColor="#B3D6A2" DataFormatString="{0:0}" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"/>
                            <asp:BoundField HeaderText="Issue Value" DataField="IssueValue" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"/>
                            <asp:BoundField HeaderText="Return Qty" DataField="ReturnQty" ItemStyle-BackColor="#B3D6A2" DataFormatString="{0:0}" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"/>
                            <asp:BoundField HeaderText="Return Value" DataField="ReturnValue" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"/>
                            <asp:BoundField HeaderText="Closing Qty" DataField="ClosingQty" ItemStyle-BackColor="#B3D6A2" DataFormatString="{0:0}" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"/>
                            <asp:BoundField HeaderText="Closing Value" DataField="ClosingValue" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"/>
                        </Columns>
                    </asp:GridView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div style="width: 500px; margin-left: 10px;">
            <table>
                <tr>
                </tr>
            </table>
        </div>
    </div>
    </form>
</body>
</html>
